package io.github.yotta.common.server.example;

import io.github.yotta.common.server.example.filter.TestFilterChainExceptionHandlerFilter;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;

/**
 * @author yotta
 * @date 2023/3/8 9:18
 */
@SpringBootApplication
public class ExampleApplication {
    public static void main(String[] args) {
        SpringApplication.run(ExampleApplication.class, args);
    }

    @Bean
    public FilterRegistrationBean<TestFilterChainExceptionHandlerFilter> registrationFilterChainExceptionHandlerFilterBean() {
        FilterRegistrationBean<TestFilterChainExceptionHandlerFilter> registrationBean = new FilterRegistrationBean<>();
        registrationBean.setFilter(new TestFilterChainExceptionHandlerFilter());
        registrationBean.addUrlPatterns("/*");
        return registrationBean;
    }
}
